home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.8 KB | 136 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWLinShp.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWLINSHP_H
- #define FWLINSHP_H
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class ODTransform;
-
- //========================================================================================
- // class FW_CLineShape
- //========================================================================================
-
- class FW_CLineShape : public FW_CShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CLineShape)
-
- //---------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- FW_CLineShape();
-
- FW_CLineShape(FW_Fixed xStart, FW_Fixed yStart,
- FW_Fixed xEnd, FW_Fixed yEnd,
- const FW_CInk& ink = FW_kNormalInk,
- const FW_CStyle& style = FW_kNormalStyle);
-
- FW_CLineShape(const FW_CPoint& start,
- const FW_CPoint& end,
- const FW_CInk& ink = FW_kNormalInk,
- const FW_CStyle& style = FW_kNormalStyle);
-
- FW_CLineShape(const FW_CLineShape& other);
- FW_CLineShape(FW_CReadableStream& stream);
-
- virtual ~ FW_CLineShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CLineShape& operator=(const FW_CLineShape& other);
-
- //---------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Hit Testing -----
- virtual FW_Boolean HitTest(FW_CGraphicContext& gc,
- const FW_CPoint& test,
- FW_Fixed tolerance) const;
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Transform -----
- virtual void Transform(Environment *ev, ODTransform* transform);
- virtual void InverseTransform(Environment *ev, ODTransform* transform);
-
- virtual void MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
- virtual void MoveShapeTo(FW_Fixed x, FW_Fixed y);
-
- virtual void Inset(FW_Fixed x, FW_Fixed y);
-
- // ----- Geometry -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
-
- // ----- Anchor Point -----
- virtual FW_CPoint GetAnchorPoint() const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& stream) const;
-
- //---------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static void RenderLine(FW_CGraphicContext& gc,
- const FW_CPoint& start,
- const FW_CPoint& end,
- const FW_CInk& ink = FW_kNormalInk,
- const FW_CStyle& style = FW_kNormalStyle);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
-
- // ----- Geometry -----
- void GetGeometry(FW_CPoint& start, FW_CPoint& end) const;
- void SetGeometry(const FW_CPoint& start, const FW_CPoint& end);
-
- FW_CPoint GetLineStart() const
- {return fStart;}
- FW_CPoint GetLineEnd() const
- {return fEnd;}
-
- void SetLineStart(FW_Fixed xStart, FW_Fixed yStart)
- {fStart.x = xStart; fStart.y = yStart;}
-
- void SetLineEnd(FW_Fixed xEnd, FW_Fixed yEnd)
- {fEnd.x = xEnd; fEnd.y = yEnd;}
-
- //---------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- FW_CPoint fStart;
- FW_CPoint fEnd;
- };
-
- #endif
-